export default {
  state: {
    isCollapse:false,
    tabsList:[
      {
        id: 1,
        name: '首页',
        path: '/Home',
        icon: '',
        url: '',
        children: null
      },
    ]
  },
  mutations: {
    //菜单的展开收起
    collapseMenu(state){
      state.isCollapse=!state.isCollapse
    },
    // 选择菜单
    selectMenu(state,val){
      if (val.path!=='/Home') {
       const index=  state.tabsList.findIndex(item => item.name === val.name)
      if (index===-1) {
         this.state.tabsList.push(val)
        }
      }
      console.log('this.state.tabsList',this.state.tabsList);
    },
    // 删除tag
    closeTag(state,item){
      const index=state.tabsList.findIndex(val=>val.name ===item.name)
      state.tabsList.splice(index,1)
    }
  },
  actions: {
  },
  modules: {
  }
}